using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Collections;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Net.Sockets;
using BrainTechLLC;

namespace Mud.EmlenMudMain
{
#if NO_SILVERLIGHT
    [Serializable]
#endif
    public class PowerData : IPowerData
    {
        private bool tps;			/* Use travel point system? */
        private bool evilGood;		/* Evil/Good conflict? */
        private bool professions;		/* Professions used or disabled? */
        private string good = "good"; // The names used for good and evil
        private string evil = "evil";
        private int[] initialHp = new int[2];	/* Initial HPCurrent points for newbies */
        private int[] remortHP = new int[2];		/* Remort initial HPCurrent points */
        private int[] initialMV = new int[2];	/* Initial MPCurrent points for newbies */
        private int[,] remortMovegain = new int[10, 4];	/* Remort MPCurrent gains in a given level range */
        private int[] remortMV = new int[2];		/* Remort initial MPCurrent points */
        private int[,] hitgain = new int[10, 5];	/* Hit gains in a given level range */
        private int[,] remortHitgain = new int[10, 5];	/* Remort HPCurrent gains in a given level range */
        private int[,] movegain = new int[10, 4];	/* Move gains in a given level range */
        private int remortLevel;		/* MinimumLevelToViewTopic you must be to remort */
        private int maxRemorts;		/* Maximum remorts */
        private bool addToStats;		/* Remorts add stats? */
        private int mustBeInRoom;	/* Must be in this currentRoom to remort */
        private bool vaporizeInventory;		/* Vaporize inventory when remorting? */
        private bool vaporizeAll;		/* Vaporize everything when remorting? */
        private bool allowRecall;		/* Allow use of the recall command? */
        private bool weather;		/* Weather effectsAffectedBy on/off */
        private int beamsToRoom;		/* Jump to this currentRoom after remorting? */
        private int raceChange;		/* Change races when remorting? */
        private string gods = "";			/* Gods who run the place */
        private int maxLevel = 90;		/* maximum level, cannot exceed 90 */
        private bool canFightSelf = true;	/* Can fight yourself? */
        private int lootLevel = 0;		/* What level can you loot a corpse? */
        private bool auctionLag = false;		/* PK Quit lag applied to auctions? */
        private bool goodKillGood = true;
        private bool evilKillEvil = true;
        private int plagueChance = 15;	/* Chance others in the currentRoom 
                                     will catch plague from you, if infected. */
        private bool loginMenu;		/* Use login menu?  unused... */
        private bool arenaOn;		/* Arena active? */
        private bool arenaGoodEvil;	/* Good/Evil fights in arena? */
        private bool chooseEvilRaces;	/* Choose evil races at newbie creation? */
        private bool playerPrompt;		/* Player defined prompts? */
        private bool skillLossOnMobDeath; /* skills lost on mob death? */
        private int amountLostOnDeath;	  /* Actual skill amount lost on death */
        private bool skillLossOnPKDeath;  /* skills lost on pk death? */
        private bool evilCanCast;		/* Evil can cast spells? */
        private int practicePercent;	/* Use to scale practices per level */
        private int[] repairWeapons = new int[3];	/* Costs to repair weapons */
        private int repairArmors;	/* Costs to repair naturalArmor */
        private int tinkerDiscount;	/* Discount for tinker guild rgMemberNames */
        private int resizeDivisor;	/* Resize divisor for resize cost */
        private int mpBonusResting;	/* Move bonus for resting */
        private int mpBonusSLeeping;	/* Move bonus for sleeping */
        private int meditationManaRegenBonus;	/* Meditating regen for mana */
        private bool allowRerolls;		/* Allow rerolls in old creation method? */
        private bool tackleWithWeapons;	/* Allow tackling with a weapon? */
        private int baseManaRegenBonus; /* Non-meditating regen for mana */
        private bool tacklePersonWithWeapon; /* Allow tackling a person with a weapon? */
        private int levelToSeeNumericStats; /* MinimumLevelToViewTopic to see numeric stats, unused. */
        private bool autoAuction;		/* Allow auto-auction? */
        private List<string> godNames = new List<string>();		/* Holds the name of mudgods. */
        private bool giveWhileFighting;	/* Give objects while chAttacking? */
        private bool scoreWhileFighting;	/* Use score while chAttacking? */
        private bool removeWhileFighting;	/* Remove naturalArmor while chAttacking? */
        private int groundfightStand;	/* Chance of standing in a groundfight */
        private bool equipInCombat;	/* Equip naturalArmor in combat? */
        private bool oldCreationMethod;	/* Old question-based creation method? */
        private bool allowWhoInLogin;	/* Allow "who" in greeting screen. */
        private int spaceNeeded;		/* Shared string space needed on bootup. */
        private bool allowWhere;		/* Allow use of 'where' command? */
        private List<long> newbieObjs = new List<long>();	/* Newbies start with these objects */
        private int maxPracSkills;	/* Maximum skill percentage you can practice to */
        private bool easierMoves;		/* Easier movement method */
        private bool validation;		/* Validation system on/off */
        private string emailTo;		/* Email to here for validation '*/
        private bool oldAttack;		/* Old attack type? */
        private int maxPracSpells;	/* Maximum spell percentage you can practice to */
        private int baseHPRegen;	/* Base hp regen per heartbeat */
        private int baseMPRegen;	/* Base mp regen per heartbeat */
        private int hpBonusResting;	/* Hp regen bonus for resting */
        private int prereq;		/* Minimum you must know a given skill for it
				   to count as a satisfied prerequisite. */
        private string expToLevel = "";/* Interpretted experience to level. */
        private List<int> highRange = new List<int>();/* Range for learned */
        private List<int> lowRange = new List<int>();/* Range for learned */
        private List<string> learned = new List<string>();		/* Description of how well 
                                                    you know spells/skills */
        private int hpBonusSleeping;	/* Hp regen bonus for sleeping */
        private int[] conApp = new int[30];
        private int[] wisApp = new int[30];
        private int[] intApp = new int[30];
        private int flurryMPS;		/* Move point cost for flurry */
        private List<string> armorLevelWord = new List<string>();	/* Armor level range descriptions. */
        private string mobExp = "";		/* Mob experience to level, interpretted. */
        private List<int> armorLevelMin = new List<int>();/* Armor level range */
        private List<int> armorLevelMax = new List<int>();/* Armor level range */
        private bool restoreWhenLevel = true;	/* Free restore when you level? */
        private bool canSummonMobs = false;	/* Does the game allow mob summoning? */
        private bool mortsUseColorChat;	/* Can morts use colors in channels? */
        private bool showRaceSelectInfo;	/* Shows race stats to newbies? */
        private int fleeChance = 0;		/* Percent chance that fleeing will fail */
        private bool bashSlipToTackle = true;	/* Can a bash slip into a groundfight? */
        private bool penalizeEvilInSun = true;	/* Penalize evil in direct sunlight? */
        private bool getFromCorpseWhileInCombat = true; /* Loot corpses while chAttacking? */


        public bool Professions
        {
            get { return professions; }
            set { professions = value; }
        }
        public bool Tps
        {
            get { return tps; }
            set { tps = value; }
        }
        public bool EvilGood
        {
            get { return evilGood; }
            set { evilGood = value; }
        }
        public string Good
        {
            get { return good; }
            set { good = value; }
        }
        public string Evil
        {
            get { return evil; }
            set { evil = value; }
        }
        public int[] InitialHp
        {
            get { return initialHp; }
            set { initialHp = value; }
        }
        public int[] RemortHP
        {
            get { return remortHP; }
            set { remortHP = value; }
        }
        public int[] InitialMV
        {
            get { return initialMV; }
            set { initialMV = value; }
        }
        public int[] RemortMV
        {
            get { return remortMV; }
            set { remortMV = value; }
        }
        public int[,] Hitgain
        {
            get { return hitgain; }
            set { hitgain = value; }
        }
        public int[,] RemortHitgain
        {
            get { return remortHitgain; }
            set { remortHitgain = value; }
        }
        public int[,] Movegain
        {
            get { return movegain; }
            set { movegain = value; }
        }
        public int[,] RemortMovegain
        {
            get { return remortMovegain; }
            set { remortMovegain = value; }
        }
        public int MustBeInRoom
        {
            get { return mustBeInRoom; }
            set { mustBeInRoom = value; }
        }
        public bool AddToStats
        {
            get { return addToStats; }
            set { addToStats = value; }
        }
        public int MaxRemorts
        {
            get { return maxRemorts; }
            set { maxRemorts = value; }
        }
        public int RemortLevel
        {
            get { return remortLevel; }
            set { remortLevel = value; }
        }
        public bool VaporizeInventory
        {
            get { return vaporizeInventory; }
            set { vaporizeInventory = value; }
        }
        public bool VaporizeAll
        {
            get { return vaporizeAll; }
            set { vaporizeAll = value; }
        }
        public int RaceChange
        {
            get { return raceChange; }
            set { raceChange = value; }
        }
        public int BeamsToRoom
        {
            get { return beamsToRoom; }
            set { beamsToRoom = value; }
        }
        public bool Weather
        {
            get { return weather; }
            set { weather = value; }
        }
        public bool AllowRecall
        {
            get { return allowRecall; }
            set { allowRecall = value; }
        }
        public bool ChooseEvilRaces
        {
            get { return chooseEvilRaces; }
            set { chooseEvilRaces = value; }
        }
        public bool PlayerPrompt
        {
            get { return playerPrompt; }
            set { playerPrompt = value; }
        }
        public bool SkillLossOnMobDeath
        {
            get { return skillLossOnMobDeath; }
            set { skillLossOnMobDeath = value; }
        }
        public bool SkillLossOnPKDeath
        {
            get { return skillLossOnPKDeath; }
            set { skillLossOnPKDeath = value; }
        }
        public int AmountLostOnDeath
        {
            get { return amountLostOnDeath; }
            set { amountLostOnDeath = value; }
        }
        public bool LoginMenu
        {
            get { return loginMenu; }
            set { loginMenu = value; }
        }
        public bool ArenaOn
        {
            get { return arenaOn; }
            set { arenaOn = value; }
        }
        public bool ArenaGoodEvil
        {
            get { return arenaGoodEvil; }
            set { arenaGoodEvil = value; }
        }
        public bool Validation
        {
            get { return validation; }
            set { validation = value; }
        }
        public string EmailTo
        {
            get { return emailTo; }
            set { emailTo = value; }
        }
        public bool OldAttack
        {
            get { return oldAttack; }
            set { oldAttack = value; }
        }
        public bool EasierMoves
        {
            get { return easierMoves; }
            set { easierMoves = value; }
        }
        public int MaxPracSpells
        {
            get { return maxPracSpells; }
            set { maxPracSpells = value; }
        }
        public int MaxPracSkills
        {
            get { return maxPracSkills; }
            set { maxPracSkills = value; }
        }

        public List<long> NewbieObjs
        {
            get { return newbieObjs; }
            set { newbieObjs = value; }
        }

        public bool AllowWhere
        {
            get { return allowWhere; }
            set { allowWhere = value; }
        }

        public int SpaceNeeded
        {
            get { return spaceNeeded; }
            set { spaceNeeded = value; }
        }

        public bool AllowWhoInLogin
        {
            get { return allowWhoInLogin; }
            set { allowWhoInLogin = value; }
        }

        public bool OldCreationMethod
        {
            get { return oldCreationMethod; }
            set { oldCreationMethod = value; }
        }

        public bool EvilCanCast
        {
            get { return evilCanCast; }
            set { evilCanCast = value; }
        }

        public int PracticePercent
        {
            get { return practicePercent; }
            set { practicePercent = value; }
        }

        public int[] RepairWeapons
        {
            get { return repairWeapons; }
            set { repairWeapons = value; }
        }


        public int RepairArmors
        {
            get { return repairArmors; }
            set { repairArmors = value; }
        }


        public int TinkerDiscount
        {
            get { return tinkerDiscount; }
            set { tinkerDiscount = value; }
        }


        public int ResizeDivisor
        {
            get { return resizeDivisor; }
            set { resizeDivisor = value; }
        }


        public int GroundfightStand
        {
            get { return groundfightStand; }
            set { groundfightStand = value; }
        }

        public bool EquipInCombat
        {
            get { return equipInCombat; }
            set { equipInCombat = value; }
        }

        public bool RemoveWhileFighting
        {
            get { return removeWhileFighting; }
            set { removeWhileFighting = value; }
        }

        public bool ScoreWhileFighting
        {
            get { return scoreWhileFighting; }
            set { scoreWhileFighting = value; }
        }

        public bool GiveWhileFighting
        {
            get { return giveWhileFighting; }
            set { giveWhileFighting = value; }
        }

        public List<string> GodNames
        {
            get { return godNames; }
            set { godNames = value; }
        }

        public bool AutoAuction
        {
            get { return autoAuction; }
            set { autoAuction = value; }
        }


        public int LevelToSeeNumericStats
        {
            get { return levelToSeeNumericStats; }
            set { levelToSeeNumericStats = value; }
        }

        public int BaseHPRegen
        {
            get { return baseHPRegen; }
            set { baseHPRegen = value; }
        }

        public int BaseMPRegen
        {
            get { return baseMPRegen; }
            set { baseMPRegen = value; }
        }

        public int HpBonusResting
        {
            get { return hpBonusResting; }
            set { hpBonusResting = value; }
        }


        public int HpBonusSleeping
        {
            get { return hpBonusSleeping; }
            set { hpBonusSleeping = value; }
        }
        public int MpBonusResting
        {
            get { return mpBonusResting; }
            set { mpBonusResting = value; }
        }

        public int MpBonusSLeeping
        {
            get { return mpBonusSLeeping; }
            set { mpBonusSLeeping = value; }
        }


        public int MeditationManaRegenBonus
        {
            get { return meditationManaRegenBonus; }
            set { meditationManaRegenBonus = value; }
        }


        public int BaseManaRegenBonus
        {
            get { return baseManaRegenBonus; }
            set { baseManaRegenBonus = value; }
        }

        public bool TackleWithWeapons
        {
            get { return tackleWithWeapons; }
            set { tackleWithWeapons = value; }
        }


        public bool TacklePersonWithWeapon
        {
            get { return tacklePersonWithWeapon; }
            set { tacklePersonWithWeapon = value; }
        }

        public bool AllowRerolls
        {
            get { return allowRerolls; }
            set { allowRerolls = value; }
        }


        public int FlurryMPS
        {
            get { return flurryMPS; }
            set { flurryMPS = value; }
        }

        public List<string> Learned
        {
            get { return learned; }
            set { learned = value; }
        }

        public List<int> LowRange
        {
            get { return lowRange; }
            set { lowRange = value; }
        }

        public List<int> HighRange
        {
            get { return highRange; }
            set { highRange = value; }
        }

        public string ExpToLevel
        {
            get { return expToLevel; }
            set { expToLevel = value; }
        }


        public int Prereq
        {
            get { return prereq; }
            set { prereq = value; }
        }
        public int[] ConApp
        {
            get { return conApp; }
            set { conApp = value; }
        }

        public int[] WisApp
        {
            get { return wisApp; }
            set { wisApp = value; }
        }


        public int[] IntApp
        {
            get { return intApp; }
            set { intApp = value; }
        }


        public string MobExp
        {
            get { return mobExp; }
            set { mobExp = value; }
        }

        public List<int> ArmorLevelMin
        {
            get { return armorLevelMin; }
            set { armorLevelMin = value; }
        }

        public List<int> ArmorLevelMax
        {
            get { return armorLevelMax; }
            set { armorLevelMax = value; }
        }

        public List<string> ArmorLevelWord
        {
            get { return armorLevelWord; }
            set { armorLevelWord = value; }
        }

        public bool RestoreWhenLevel
        {
            get { return restoreWhenLevel; }
            set { restoreWhenLevel = value; }
        }

        public bool CanSummonMobs
        {
            get { return canSummonMobs; }
            set { canSummonMobs = value; }
        }

        public bool MortsUseColorChat
        {
            get { return mortsUseColorChat; }
            set { mortsUseColorChat = value; }
        }

        public bool ShowRaceSelectInfo
        {
            get { return showRaceSelectInfo; }
            set { showRaceSelectInfo = value; }
        }

        public int FleeChance
        {
            get { return fleeChance; }
            set { fleeChance = value; }
        }

        public bool BashSlipToTackle
        {
            get { return bashSlipToTackle; }
            set { bashSlipToTackle = value; }
        }

        public bool PenalizeEvilInSun
        {
            get { return penalizeEvilInSun; }
            set { penalizeEvilInSun = value; }
        }

        public bool GetFromCorpseWhileInCombat
        {
            get { return getFromCorpseWhileInCombat; }
            set { getFromCorpseWhileInCombat = value; }
        }

        public int PlagueChance
        {
            get { return plagueChance; }
            set { plagueChance = value; }
        }

        public string Gods
        {
            get { return gods; }
            set { gods = value; }
        }

        public int MaxLevel
        {
            get { return maxLevel; }
            set { maxLevel = value; }
        }

        public bool CanFightSelf
        {
            get { return canFightSelf; }
            set { canFightSelf = value; }
        }

        public int LootLevel
        {
            get { return lootLevel; }
            set { lootLevel = value; }
        }

        public bool AuctionLag
        {
            get { return auctionLag; }
            set { auctionLag = value; }
        }

        public bool GoodKillGood
        {
            get { return goodKillGood; }
            set { goodKillGood = value; }
        }

        public bool EvilKillEvil
        {
            get { return evilKillEvil; }
            set { evilKillEvil = value; }
        }

        public string readPowerDat(string SzHostPathname)
        {
            char[] spc = new char[1];
            spc[0] = ' ';
            FileStream fs = null;
            try
            {
                fs = new FileStream(SzHostPathname + "\\" + MiscConstants.DataFileDirectory + "\\power.dat", FileMode.Open, FileAccess.Read);
            }
            catch (IOException ex)
            {
                EmlenMud.LogError("Error reading power.dat", ex, LogType.Always);
                return "Error reading power.dat: " + ex.Message;
            }

            StreamReader sr = new StreamReader(fs);
            string szLine = sr.ReadLine().Trim();
            int hg = 0; int mg = 0;
            int rhg = 0; int rmg = 0;

            while (szLine != "END" && sr.EndOfStream == false)
            {
                if (szLine.Trim() != "" && szLine[0] != '#')
                {
                    string[] rgsz = szLine.Split(spc, 2, StringSplitOptions.RemoveEmptyEntries);
                    if (rgsz.Length > 0)
                    {
                        string szWord = rgsz[0];
                        if (szWord == "USE_PROFESSIONS") professions = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "USE_TPS_SYSTEM") tps = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "INITIAL_HP")
                        {
                            string[] rgS = rgsz[1].Split(spc, 2, StringSplitOptions.RemoveEmptyEntries);
                            initialHp[0] = Convert.ToInt32(rgS[0]);
                            initialHp[1] = Convert.ToInt32(rgS[1]);
                        }
                        else if (szWord == "REMORT_HP")
                        {
                            string[] rgS = rgsz[1].Split(spc, 2, StringSplitOptions.RemoveEmptyEntries);
                            remortHP[0] = Convert.ToInt32(rgS[0]);
                            remortHP[1] = Convert.ToInt32(rgS[1]);
                        }
                        else if (szWord == "INITIAL_MV")
                        {
                            string[] rgS = rgsz[1].Split(spc, 2, StringSplitOptions.RemoveEmptyEntries);
                            initialMV[0] = Convert.ToInt32(rgS[0]);
                            initialMV[1] = Convert.ToInt32(rgS[1]);
                        }
                        else if (szWord == "REMORT_MV")
                        {
                            string[] rgS = rgsz[1].Split(spc, 2, StringSplitOptions.RemoveEmptyEntries);
                            remortMV[0] = Convert.ToInt32(rgS[0]);
                            remortMV[1] = Convert.ToInt32(rgS[1]);
                        }
                        else if (szWord == "REG_HITGAIN")
                        {
                            string[] rgS = rgsz[1].Split(spc, 5, StringSplitOptions.RemoveEmptyEntries);
                            hitgain[hg, 0] = Convert.ToInt32(rgS[0]);
                            hitgain[hg, 1] = Convert.ToInt32(rgS[1]);
                            hitgain[hg, 2] = Convert.ToInt32(rgS[2]);
                            hitgain[hg, 3] = Convert.ToInt32(rgS[3]);
                            hitgain[hg, 4] = Convert.ToInt32(rgS[4]);
                            hg++;
                        }
                        else if (szWord == "REM_HITGAIN")
                        {
                            string[] rgS = rgsz[1].Split(spc, 5, StringSplitOptions.RemoveEmptyEntries);
                            remortHitgain[rhg, 0] = Convert.ToInt32(rgS[0]);
                            remortHitgain[rhg, 1] = Convert.ToInt32(rgS[1]);
                            remortHitgain[rhg, 2] = Convert.ToInt32(rgS[2]);
                            remortHitgain[rhg, 3] = Convert.ToInt32(rgS[3]);
                            remortHitgain[rhg, 4] = Convert.ToInt32(rgS[4]);
                            rhg++;
                        }
                        else if (szWord == "REG_MOVEGAIN")
                        {
                            string[] rgS = rgsz[1].Split(spc, 4, StringSplitOptions.RemoveEmptyEntries);
                            movegain[mg, 0] = Convert.ToInt32(rgS[0]);
                            movegain[mg, 1] = Convert.ToInt32(rgS[1]);
                            movegain[mg, 2] = Convert.ToInt32(rgS[2]);
                            movegain[mg, 3] = Convert.ToInt32(rgS[3]);
                            mg++;
                        }
                        else if (szWord == "REM_MOVEGAIN")
                        {
                            string[] rgS = rgsz[1].Split(spc, 4, StringSplitOptions.RemoveEmptyEntries);
                            remortMovegain[rmg, 0] = Convert.ToInt32(rgS[0]);
                            remortMovegain[rmg, 1] = Convert.ToInt32(rgS[1]);
                            remortMovegain[rmg, 2] = Convert.ToInt32(rgS[2]);
                            remortMovegain[rmg, 3] = Convert.ToInt32(rgS[3]);
                            rmg++;
                        }
                        else if (szWord == "MUST_BE_IN_ROOM") mustBeInRoom = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "PRAC_LEVEL")
                        {
                            string[] rgS = rgsz[1].Split(spc, 3, StringSplitOptions.RemoveEmptyEntries);
                            lowRange.Add(Convert.ToInt32(rgS[0]));
                            highRange.Add(Convert.ToInt32(rgS[1]));
                            learned.Add(rgS[2]);
                        }
                        else if (szWord == "ADDS_TO_STATS") addToStats = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "MAXIMUM_REMORTS") maxRemorts = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "REMORT_LEVEL") remortLevel = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "VAPORIZE_INVENTORY") vaporizeInventory = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "VAPORIZE_ENTIRE_EQU") vaporizeAll = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "GET_FROM_CORPSE_WHILE_IN_COMBAT") getFromCorpseWhileInCombat = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "SHOW_RACE_SELECT_INFO") showRaceSelectInfo = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "GOOD_KILL_GOOD") goodKillGood = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "EVIL_KILL_EVIL") evilKillEvil = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "MORTS_USE_COLOR_CHAT") mortsUseColorChat = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "RESTORE_WHEN_LEVEL") restoreWhenLevel = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "CHANGES_RACE_TO") raceChange = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "PLAGUE_CHANCE") plagueChance = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "BEAMS_TO_ROOM") beamsToRoom = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "ONLY_WAY_EVIL_IS_THRU_REMORT") evilGood = ((rgsz[1])[0] == 'Y') ? false : true;
                        else if (szWord == "PREREQ_LEVEL") prereq = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "WEATHER_EFFECTS") weather = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "ALLOW_RECALL") allowRecall = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "CHOOSE_EVIL_RACES") chooseEvilRaces = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "PLAYER_PROMPT") playerPrompt = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "SKILL_LOSS_ON_DEATH") skillLossOnMobDeath = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "SKILL_LOSS_ON_PK_DEATH") skillLossOnPKDeath = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "SKILL_LOSS_AMOUNT") amountLostOnDeath = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "USE_LOGIN_MENU") loginMenu = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "ARENA_ON") arenaOn = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "ARENA_GOOD_EVIL") arenaGoodEvil = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "REQUIRED_VALIDATION") validation = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "MUD_EMAIL_ADDRESS") emailTo = rgsz[1];
                        else if (szWord == "OLD_ATTACK_STYLE") oldAttack = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "EASIER_MOVE_STYLE") easierMoves = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "MAX_PRACTICE_SKILLS") amountLostOnDeath = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "EXP") mobExp = rgsz[1];
                        else if (szWord == "EXP_TO_LEVEL") expToLevel = rgsz[1];
                        else if (szWord == "MAX_PRACTICE_SPELLS") maxPracSpells = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "NEWBIE_OBJECT_1") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_2") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_3") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_4") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_5") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_6") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_7") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_8") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_9") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "NEWBIE_OBJECT_10") newbieObjs.Add(Convert.ToInt32(rgsz[1]));
                        else if (szWord == "ALLOW_WHERE") allowWhere = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "ALLOW_WHO_IN_LOGIN") allowWhoInLogin = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "OLD_CREATION_METHOD") oldCreationMethod = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "CAN_SUMMON_MOBS") canSummonMobs = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "EVIL_CAN_CAST_SPELLS") evilCanCast = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "PERCENT_PRACTICES") practicePercent = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "REPAIR_WEAPONS")
                        {
                            string[] rgS = rgsz[1].Split(spc, 3, StringSplitOptions.RemoveEmptyEntries);
                            repairWeapons[0] = Convert.ToInt32(rgS[0]);
                            repairWeapons[1] = Convert.ToInt32(rgS[1]);
                            repairWeapons[2] = Convert.ToInt32(rgS[2]);
                        }

                        else if (szWord == "REPAIR_ARMORS") repairArmors = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "TINKER_DISCOUNT") tinkerDiscount = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "RESIZE_DIVISOR") resizeDivisor = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "SPACE_NEEDED") { }
                        else if (szWord == "EQUIP_IN_COMBAT") equipInCombat = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "REMOVE_WHILE_FIGHTING") removeWhileFighting = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "SCORE_WHILE_FIGHTING") scoreWhileFighting = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "AUTO_AUCTION") autoAuction = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "FIGHT_SELF") canFightSelf = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "LOOT_LEVEL") lootLevel = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "MAX_LEVEL") maxLevel = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "AUCTION_LAG") auctionLag = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "GIVE_WHILE_FIGHTING") giveWhileFighting = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "FLEE_CHANCE") fleeChance = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "PENALIZE_EVIL_IN_SUN") penalizeEvilInSun = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "BASH_SLIP_TO_TACKLE") bashSlipToTackle = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "TACKLE_WITH_WEAPON") tackleWithWeapons = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "TACKLE_PERSON_WITH_WEAPON") tacklePersonWithWeapon = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "ALLOW_REROLLS") allowRerolls = ((rgsz[1])[0] == 'Y') ? true : false;
                        else if (szWord == "REGEN_MANA")
                        {
                            string[] rgS = rgsz[1].Split(spc, 2, StringSplitOptions.RemoveEmptyEntries);
                            baseManaRegenBonus = Convert.ToInt32(rgS[0]);
                            meditationManaRegenBonus = Convert.ToInt32(rgS[1]);
                        }
                        else if (szWord == "REGEN_HP")
                        {
                            string[] rgS = rgsz[1].Split(spc, 3, StringSplitOptions.RemoveEmptyEntries);
                            baseHPRegen = Convert.ToInt32(rgS[0]);
                            hpBonusResting = Convert.ToInt32(rgS[1]);
                            hpBonusSleeping = Convert.ToInt32(rgS[2]);
                        }
                        else if (szWord == "REGEN_MP")
                        {
                            string[] rgS = rgsz[1].Split(spc, 3, StringSplitOptions.RemoveEmptyEntries);
                            baseMPRegen = Convert.ToInt32(rgS[0]);
                            mpBonusResting = Convert.ToInt32(rgS[1]);
                            mpBonusSLeeping = Convert.ToInt32(rgS[2]);
                        }
                        else if (szWord == "GROUNDFIGHT_STAND") groundfightStand = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "FLURRY_MPS") flurryMPS = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "LEVEL_TO_SEE_NUMERIC_STATS") levelToSeeNumericStats = Convert.ToInt32(rgsz[1]);
                        else if (szWord == "HPS_FOR_CON")
                        {
                            string[] rgS = rgsz[1].Split(spc, 30, StringSplitOptions.RemoveEmptyEntries);
                            for (int k = 0; k < 30; k++)
                            {
                                conApp[k] = Convert.ToInt32(rgS[k]);
                            }
                        }
                        else if (szWord == "PRACS_FOR_WIS")
                        {
                            string[] rgS = rgsz[1].Split(spc, 30, StringSplitOptions.RemoveEmptyEntries);
                            for (int k = 0; k < 30; k++)
                            {
                                wisApp[k] = Convert.ToInt32(rgS[k]);
                            }
                        }
                        else if (szWord == "PRAC_INCREASE_FOR_INTELLIGENCE")
                        {
                            string[] rgS = rgsz[1].Split(spc, 30, StringSplitOptions.RemoveEmptyEntries);
                            for (int k = 0; k < 30; k++)
                            {
                                intApp[k] = Convert.ToInt32(rgS[k]);
                            }
                        }
                        else if (szWord == "ARMOR_LEV")
                        {
                            string[] rgS = rgsz[1].Split(spc, 3, StringSplitOptions.RemoveEmptyEntries);
                            armorLevelMin.Add(Convert.ToInt32(rgS[0]));
                            armorLevelMax.Add(Convert.ToInt32(rgS[1]));
                            armorLevelWord.Add(rgS[2]);
                        }
                        else if (szWord == "GODS") gods = rgsz[1];
                        else if (szWord == "SACNAMES")
                        {
                            string[] rgS = rgsz[1].Split(spc, 5, StringSplitOptions.RemoveEmptyEntries);
                            if (rgS.Length > 0) godNames.Add(rgS[0]);
                            if (rgS.Length > 1) godNames.Add(rgS[1]);
                            if (rgS.Length > 2) godNames.Add(rgS[2]);
                            if (rgS.Length > 3) godNames.Add(rgS[3]);
                            if (rgS.Length > 4) godNames.Add(rgS[4]);
                        }
                    }
                }
                szLine = sr.ReadLine().Trim();
            }
            sr.Close();
            return "";
        }

    }
}
